﻿Imports System.Data.OleDb


Public Class UserProfileView
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load




        Dim sql As String = "SELECT * FROM UserProfile WHERE Username=@19"


        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
        conn.Open()

        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)

        cmd.Parameters.AddWithValue("@f1", Request.QueryString("Username"))

        Dim datareader = cmd.ExecuteReader

        datareader.Read()

        If Not IsDBNull(datareader("FirstName")) Then lblfirstname.Text = datareader("FirstName")
        If Not IsDBNull(datareader("LastName")) Then lbllastname.Text = datareader("LastName")
        If Not IsDBNull(datareader("DOB")) Then lbldob.Text = (datareader("DOB"))
        If Not IsDBNull(datareader("UserImage")) Then imgprofilepicture.ImageUrl = datareader("UserImage")


        If Not IsDBNull(datareader("Address1")) Then lbladdress1.Text = datareader("Address1")
        If Not IsDBNull(datareader("Address2")) Then lbladdress2.Text = datareader("Address2")
        If Not IsDBNull(datareader("Town")) Then lbltown.Text = datareader("Town")
        If Not IsDBNull(datareader("City")) Then lblcity.Text = datareader("City")
        If Not IsDBNull(datareader("City")) Then lblcity2.Text = datareader("City")
        If Not IsDBNull(datareader("Postcode")) Then lblpostcode.Text = datareader("Postcode")
        If Not IsDBNull(datareader("TelNo")) Then lbltelno.Text = datareader("TelNo")
        If Not IsDBNull(datareader("AboutMe")) Then txtaboutme.Text = datareader("AboutMe")
        If Not IsDBNull(datareader("X6CarsDriven")) Then txtexperience.Text = datareader("X6CarsDriven")
        If Not IsDBNull(datareader("FavouriteColour")) Then lblfavouritecolour.Text = datareader("FavouriteColour")
        If Not IsDBNull(datareader("MaxSpeedDriven")) Then lblmaxspeeddriven.Text = datareader("MaxSpeedDriven")
        If Not IsDBNull(datareader("PreferedFuel")) Then lblpreferedfuel.Text = datareader("PreferedFuel")
        If Not IsDBNull(datareader("PreferedLitre")) Then lblpreferedlitre.Text = datareader("PreferedLitre")
        If Not IsDBNull(datareader("Gender")) Then lblgender.Text = datareader("Gender")
        If Not IsDBNull(datareader("RegistrationDate")) Then lblregistrationdate.Text = datareader("RegistrationDate")


        datareader.Close()




    End Sub
End Class